##parameters=modelIdentities=None

context.assertRole("Manager")

securityService = context.knowledgeengine_securityservice

if modelIdentities:
    models = filter(None,[context.getComponentByIdentity( modelIdentity ) for modelIdentity in modelIdentities])        
else:        
    models = [brain.getObject() for brain in context.portal_catalog(meta_type="Model")]
    
    
results = []
    
for model in models:
    
    results += securityService.getPermissions( model.getIdentity() )
    
    for component in model.getDescendants().values():
        results += securityService.getPermissions( component.getIdentity() )
        
    
return results 